﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using ExamDemo.Models;
using ExamDemo.Data;

namespace tinyTalk.Data
{
    public class TinyTalkDbInitilizer : DropCreateDatabaseAlways<ExamDemoDb>
    {

        protected override void Seed(ExamDemoDb db)
        {

            db.Users.Add(new Users
            {

                Username = "lzl",
                Password = "123",
                //CreatedAt = DateTime.Now,
                //UpdatedAt = DateTime.Now,
                Version = 0,

            });
            db.Users.Add(new Users
            {

                Username = "admin",
                Password = "123",
                //CreatedAt = DateTime.Now,
                //UpdatedAt = DateTime.Now,
                Version = 0,
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId = 1,
                    Content = "",
                //CreatedAt = DateTime.Now,
                //UpdatedAt = DateTime.Now,
                Version = 0,

                },

            });

            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                MsgId = 1,
                Content = "太阳天或下雨天",
                //FromUserId = 1,
                //CreatedAt = DateTime.Now,
                //UpdatedAt = DateTime.Now,
                Version = 0,

                },
            });
            db.SaveChanges();
            base.Seed(db);
        }
    }
}